package com.sczmgk.hotline_pzh.JavaScript;

import android.content.Context;
import android.webkit.JavascriptInterface;



public class JavaScriptObject {

    private OnJsCallbackListener onJsCallbackListener;
    private Context mContxt;

    public JavaScriptObject(Context mContxt, OnJsCallbackListener onJsCallbackListener) {
        this.onJsCallbackListener = onJsCallbackListener;
        this.mContxt = mContxt;
    }
    //17之后的版本，必须加该注解,否则无法调用
    @JavascriptInterface
    public void fun1FromAndroid(String name) {
        if(onJsCallbackListener != null){
            onJsCallbackListener.onGoHome(name);
        }

    }
    //17之后的版本，必须加该注解,否则无法调用
    @JavascriptInterface
    public void fun2(String name) {
        if(onJsCallbackListener != null){
            onJsCallbackListener.onJsCallback(name);
        }
    }
}
